package UnitTest.DataStructureTest.treeTest.binaryTreeTest.binaryTreeApplyTest;

import DataStructure.tree.binaryTree.binaryTreeApply.BT_BalanceJudge;
import TestData.DataStructureTestData.treeTestData.binaryTreeTestData.BinaryTreeBuildDemo;
import TestData.DataStructureTestData.treeTestData.binaryTreeTestData.BinaryTreeTestDemo;
import UnitTest.DataStructureTest.treeTest.binaryTreeTest.binaryTreeTestData.BT_TestData_Tree;
import org.junit.Test;

/**
 * @author liujun
 * @version 1.0
 * @date 2020/11/4
 * @author—Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 判断平衡二叉树 测试案例
 */

public class BT_BalanceJudgeTest extends BT_TestData_Tree {

    @Test
    public void testJudge() {
        test(new BT_BalanceJudge());
    }

    public void test(BT_BalanceJudge instance) {
        boolean balance = instance.judgeBalance(Tree_BT_Full_Level_WithNLF_1());
        assert balance;
        balance = instance.judgeBalance(Tree_BT_Full_Level_WithNLF_2());
        assert balance;
        balance = instance.judgeBalance(Tree_BT_Full_Level_WithNLF_3());
        assert balance;
        balance = instance.judgeBalance(Tree_BT_Full_Level_WithNLF_4());
        assert balance;
        balance = instance.judgeBalance(Tree_BT_Level_WithNLF_1());
        assert balance;
        balance = instance.judgeBalance(Tree_BT_Level_WithNLF_2());
        assert balance;
        balance = instance.judgeBalance(Tree_BT_Level_WithNLF_3());
        assert !balance;
        balance = instance.judgeBalance(Tree_BT_Level_WithNLF_4());
        assert balance;
        balance = instance.judgeBalance(Tree_BT_Level_WithNLF_5());
        assert !balance;
        balance = instance.judgeBalance(Tree_BT_Level_WithNLF_6());
        assert !balance;
        balance = instance.judgeBalance(Tree_BT_Level_WithNLF_7());
        assert !balance;
        balance = instance.judgeBalance(Tree_BT_Level_WithNLF_8());
        assert !balance;
    }
}
